using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_currencyMap : EntityTypeConfiguration<so_currency>
    {
        public so_currencyMap()
        {
            // Primary Key
            this.HasKey(t => new { t.SYMBOL, t.Currency_Id });

            // Properties
            this.Property(t => t.Currency)
                .HasMaxLength(20);

            this.Property(t => t.SYMBOL)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.Currency_Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            // Table & Column Mappings
            this.ToTable("so_currency");
            this.Property(t => t.Currency).HasColumnName("Currency");
            this.Property(t => t.SYMBOL).HasColumnName("SYMBOL");
            this.Property(t => t.Currency_Id).HasColumnName("Currency_Id");
        }
    }
}
